package com.avril.entity;

import java.util.Date;
import java.util.HashMap;
import java.util.Vector;

import com.avril.constants.Constants;
import com.avril.util.DateUtils;
import com.avril.util.ValidationManager;

public class Order {
	public static HashMap<String, String> statusMap = new HashMap<String, String>();
	static {
		statusMap.put(Constants.STATUS_OF_IMPORT, Constants.STATUS_IMPORT);
		statusMap.put(Constants.STATUS_OF_BACK, Constants.STATUS_BACK);
		statusMap.put(Constants.STATUS_OF_FINISH, Constants.STATUS_FINISH);
	}
	int orderId;
	String orderCode;
	String userName;
	float totalPrice;
	Date createWhen;
	String orderStatus;
	String inOrOut;
	Vector<OrderDetail> orderDetails;

	public int getOrderId() {
		return orderId;
	}

	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public float getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(float totalPrice) {
		this.totalPrice = totalPrice;
	}

	public Date getCreateWhen() {
		return createWhen;
	}

	public void setCreateWhen(Date createWhen) {
		this.createWhen = createWhen;
	}

	public String getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}

	public String getInOrOut() {
		return inOrOut;
	}

	public void setInOrOut(String inOrOut) {
		this.inOrOut = inOrOut;
	}

	public Vector<OrderDetail> getOrderDetails() {
		return orderDetails;
	}

	public void setOrderDetails(Vector<OrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}

	public String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

	public Object getOrderValue(int row, int col) {
		switch (col) {
		case 0:
			return ++row + "";
		case 1:
			return ValidationManager.changeNull(getOrderCode());
		case 2:
			return ValidationManager.changeNull(getTotalPrice());
		case 3:
			return ValidationManager.changeNull(DateUtils
					.parseDateToFullTimeByComma(getCreateWhen()));
		case 4:
			return ValidationManager.changeNull(getUserName());
		case 5:
			return ValidationManager
					.changeNull(statusMap.get(getOrderStatus()));
		}
		return null;
	}

}
